package cn.edu.ctbu.labtest.controller;

import cn.edu.ctbu.labtest.domain.Student;
import cn.edu.ctbu.labtest.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class StudentController {
/*
*

    @RequestMapping("/student/findall")
    public List<Student>findall(){
        return studentService.findAll();
    }
* */
    @Autowired
    StudentService studentService;
    @RequestMapping("/student/list")
    public String List(Model model){

        List<Student>students=studentService.findAll();

        model.addAttribute("data",students);

        return"/student/list";
    }
    /* 查询
    @RequestMapping("/student/find")
    public String find(Model model,String name) {
        List<Student> jieguo = studentService.findStudentByName(name);
        model.addAttribute("data",jieguo);
        if (jieguo == null || jieguo.isEmpty()) {
            return "/student/wujieguo";
        }
        return "/student/list";
    }*/
}
